package com.sojson.util.security.shiro.interceptor.core;

import org.apache.shiro.spring.aop.SpringAnnotationResolver;

import com.sojson.util.security.shiro.interceptor.LoginAnnotationMethodInterceptor;
import com.sojson.util.security.shiro.interceptor.RequiredPermissionAnnotationMethodInterceptor;
import com.sojson.util.security.shiro.interceptor.RequiredRoleAnnotationMethodInterceptor;

/**
 * 负责添加拦截器
 * 原来继承的是:org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor
 * 之前添加拦截器是在AopAllianceAnnotationsAuthorizingMethodInterceptor的构造方法中,现在把添加的功能单独移出来
 * 
 * @author liu
 * @Date 2020-06-11 18:29:08
 * @Description
 *
 */
public class CustomAddAuthorizingAnnotationMethodInterceptor
    extends CustomAopAllianceAnnotationsAuthorizingMethodInterceptor {

    /**
     * 添加对应注解拦截器(添加拦截器)
     */
    public CustomAddAuthorizingAnnotationMethodInterceptor() {
        // 调用父类的构造方法添加默认的几个拦截器(因为父类已经重写,所以不再添加,全用自己的)
        super();
        System.out.println(
            "拦截器:MineAopAllianceAnnotationsAuthorizingMethodInterceptor:MineAopAllianceAnnotationsAuthorizingMethodInterceptor");
        this.methodInterceptors.add(new LoginAnnotationMethodInterceptor(new SpringAnnotationResolver()));
        this.methodInterceptors.add(new RequiredPermissionAnnotationMethodInterceptor(new SpringAnnotationResolver()));
        this.methodInterceptors.add(new RequiredRoleAnnotationMethodInterceptor(new SpringAnnotationResolver()));
    }

}
